#include<iostream>
#include<cstring>

using namespace std;
class MyPrint{
public:
    void operator() (int num){
        cout<<"num "<<num<<endl;
        count++;
    }
    int count = 0; 
};

//函数对象作为参数  
void doPrint(MyPrint print, int num){
    print(num);
}

void test01(){
    MyPrint my_print;
    my_print(111);

    MyPrint()(100);

    //内部可以保存状态  
    my_print(222);
    cout<<"调用次数：  "<<my_print.count<<endl;

    //
    doPrint(MyPrint(), 333);

}

int main(){
    test01();
    return 0;
}